package com.tester.yaa.exam001.adapter;

import com.tester.yaa.exam001.adapter.server.Charging;
import com.tester.yaa.exam001.adapter.server.CurrentConversion;
import com.tester.yaa.exam001.adapter.server.IPhone;

/**
 * @Aduthor yinanan
 * @ClassName Adapter
 * @Date 2022/12/4 20:12
 * @Description 定义充电转换的适配器
 **/
public class Adapter implements CurrentConversion {

    private Charging charging;

    /** 
    * 传入需要适配类
    */ 
    public Adapter(Charging charging) {
        this.charging = charging;
    }
    
    /** 
    * @Description: //执行充电器
    * @author: yinanan
    * @Param: []
    * @return: void  
    * @Date: 2022/12/4
    */ 
    @Override
    public void currentConversion() {
        charging.Charging();
    }

    //执行
    public static void main(String[] args) {
        IPhone iPhone = new IPhone();//手机
        Charging charging = new Charging();//充电器
        //运用充电器适配类，进行手机充电
        CurrentConversion adapter = new Adapter(charging);
        iPhone.charging(adapter);
    }
}
